$(function(){
        // 创建 URLSearchParams 对象
        var params = new URLSearchParams(window.location.search);
        var username = localStorage.getItem("parameter");
        var password = localStorage.getItem("password");
        var token = localStorage.getItem("token");
        var productId = params.get('ID');
        $("#earn-choosedVal").click(function() {
                let choosedVal =  parseFloat(localStorage.getItem("choosedVal"));
                var url = "http://127.0.0.1:8080/product/do/mark/"
                $.ajax({
                        url:url,
                        type:"POST",
                        async: true,    //是否异步
                        data:{
                                productId:productId,
                                token:token,
                                mark:choosedVal/2.0
                        },success:function(response){
                                alert("您已经评分："+choosedVal/2.0)
                                console.log(response)
                        }
                })
        });
})
